package com.hxk;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * error级别日志处理-消费者
 * @author Cactus
 */
@Component
//采用监听器
@RabbitListener(
			bindings=@QueueBinding(
				//配置交换器
				exchange=@Exchange(value="${mq.config.exchange}",type=ExchangeTypes.DIRECT),
				//配置路由键
				key="${mq.config.queue.error.routing.key}",
				//配置队列名称
				value=@Queue(value="${mq.config.queue.error}",autoDelete="true")
			)
		)
public class ErrorConsumer {

	@RabbitHandler//标注该方法为一个消息处理方法
	public void process(String msg) {
		System.out.println("error......msg..."+msg);
	}
}
